package com.example.demo.config;

import com.example.demo.entity.GetMsgVo;
import com.example.demo.mapper.DeletelogMapper;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class Deletelogconfig
{
   @Autowired
   private DeletelogMapper deletelogMapper;


   @AfterReturning("execution(public * com.example.demo.Service.AdminlengService.userUpdate(..))")
   public void updateLog(JoinPoint joinPoint)
   {
      GetMsgVo msgVo= (GetMsgVo) joinPoint.getArgs()[0];
      System.out.println(msgVo.toString());
      deletelogMapper.insertlog(msgVo);
   }
   @AfterReturning("execution(public * com.example.demo.Service.AdminlengService.userDelete(..))")
   public void deleteLog(JoinPoint joinPoint)
   {
      GetMsgVo msgVo= (GetMsgVo) joinPoint.getArgs()[0];
      System.out.println(msgVo.toString());
      deletelogMapper.insertlog(msgVo);
   }
   @AfterReturning("execution(public * com.example.demo.Service.AdminlengService.userSet(..))")
   public void inputLog(JoinPoint joinPoint)
   {
      GetMsgVo msgVo= (GetMsgVo) joinPoint.getArgs()[0];
      System.out.println(msgVo.toString());
      deletelogMapper.insertlog(msgVo);
   }
   @AfterReturning("execution(public * com.example.demo.Service.AdminlengService.userSelect(..))")
   public void selectLog(JoinPoint joinPoint)
   {
      GetMsgVo msgVo= (GetMsgVo) joinPoint.getArgs()[0];
      System.out.println(msgVo.toString());
      deletelogMapper.insertlog(msgVo);
   }
}
